<html lang="en" data-dpr="1" style="font-size: 54.8px;"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <script type="text/javascript" src="./flexible.js"></script>
    <title>mountian</title>
    <link href="./index.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/js-cookie/2.1.4/js.cookie.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.16.2/axios.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.18.1/moment.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
	<div class="body1">
		<div id="top">
			<img class="top-manu" src="./menu.png">
			<div class="top-title">
				MOUNTIAN
			</div>
		</div>
		<div class="action-png">
		</div>
		<div class="notice">
			<div class="notice-1"></div>
		</div>

        <div class="main" style="background: url(./bg1.png) no-repeat center; background-size: 7.5rem 10.2rem;">
        
            <div class="main-1-1">MOUNTAIN钱包</div>
            <div class="main-1-2">最安全的数字资产管家</div>
            <img src="./more_down.png" style="width: 0.28rem; height: 0.28rem;padding-top: 0.38rem;padding-left: 3rem;float: left; ">
            <div class="main-1-3">了解更多</div>
        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg2.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-2-1">私钥种子一手掌握</div>
            <div class="main-2-2">使用密语种子</div>
            <div class="main-2-3">全部资产私钥完全掌控</div>
        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg3.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-3-1">硬件保护加密种子</div>
            <div class="main-3-2">私钥种子层层加密</div>
            <div class="main-3-3">物理隔绝永不触网</div>
        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg4.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-4-1">冷热分离，安全易用</div>
            <div class="main-4-2">热钱包构造交易&nbsp;&nbsp;冷钱包私钥签名</div>
        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg5.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-5-1">完全隔离网络</div>
            <div class="main-5-2">永不联网，彻底根绝网络黑客入侵</div>
        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg6.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-6-1">MOUNTAIN钱包</div>
            <div style="height: 0.25rem"></div>
            <a class="main-6-2"  target="_blank" href="https://uland.taobao.com">立即购买&nbsp;〉</a>

        </div>
        <div style="height: 0.16rem;"></div>

        <div class="main" style="background: url(./bg7.png) no-repeat center; background-size: 7.5rem 10.2rem;">
            <div class="main-7-1">链付宝APP</div>
            <div class="main-7-2">引领数字货币支付新时代</div>
        </div>
        

        <div class="main-8-1">
            <div class="main-8-1-1">基本功能</div>
            <div style="height: 0.14rem;"></div>
            <div class="main-8-1-2"></div>
            <div style="height: 0.34rem;"></div>
            <div class="main-8-1-3">
                <div style="height: 0.45rem;"></div>
                <div style="line-height: 0.8rem;text-align:center;clear:both;">
                    <div style="float: left;width: 0.68rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-1" ></div>
                    <div style="float: left;width: 0.34rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-2" >私钥和助记词的生产与管理；</div>
                </div>
                <div style="line-height: 0.8rem;text-align:center;clear:both;">
                    <div style="float: left;width: 0.68rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-1" ></div>
                    <div style="float: left;width: 0.34rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-2" >钱包地址的生成；</div>
                </div>
                <div style="line-height: 0.8rem;text-align:center; clear:both;">
                    <div style="float: left;width: 0.68rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-1" ></div>
                    <div style="float: left;width: 0.34rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-2" >支持导入其他钱包生成的私钥、助记词；</div>
                </div>
                <div style="line-height: 0.8rem;text-align:center; clear:both;">
                    <div style="float: left;width: 0.68rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-1" ></div>
                    <div style="float: left;width: 0.34rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-2" >数字资产的接收与转账；</div>
                </div>
                <div style="line-height: 0.8rem;text-align:center; clear:both;">
                    <div style="float: left;width: 0.68rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-1" ></div>
                    <div style="float: left;width: 0.34rem;height: 0.2rem"></div>
                    <div class="main-8-1-3-2" >交易记录的查询；</div>
                </div>

            </div>
        </div>

	</div>
</body>

	

	
	


<script>
	var all = {};
	var count = [0,1];
	//计算已选场数，已选注数
	//期数
	var num = 0;

    //渲染
    function render(index,val) {
        return $('<div style = "height:2.96rem;">'+
            '<div style = "height:0.2rem;"></div>'+
            '<div style = "height:2.76rem; background:#FFFFFF;">'+
                '<div style = "height:0.3rem; "></div>'+
                '<div style = "height:0.96rem;margin-left: 0.3rem;">'+
                '<div id = "num">'+((index-0)+1)+'</div>'+
                    '<div style = "height:0.96rem;margin-left: 0.74rem;">'+
                        '<div style="height:0.3rem;font-size: 0.3rem;line-height: 0.3rem; color :#F46E44;">'+
                        val.league+
                        '</div>'+
                        '<div style = "height:0.12rem; "></div>'+
                        '<div id = "date">'+
                        '<span>'+val.date+'&nbsp&nbsp'+val.time+'</span>'+
                        '</div>'+
                    '</div>'+
                '</div>'+
                '<div style = "margin-left: 0.3rem;margin-right: 0.3rem;height:1.20rem; " class="card-body">'+
                    '<div class = "main-left" data-id="'+index+'">'+
                        '<div style = "height:0.26rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">'+
                            val.home_team+
                        '</div>'+
                        '<div style = "height:0.08rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">'+
                            val.home_chance+
                        '</div>'+
                    '</div>'+
                    '<div class="main-center" data-id="' +index + '">'+
                        '<div style = "height:0.26rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">平局</div>'+
                        '<div style = "height:0.08rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">'+
                            val.flat_chance+
                        '</div>'+
                    '</div>'+
                    '<div class = "main-right" data-id="' +index + '">'+
                        '<div style = "height:0.26rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">'+
                            val.guest_team+
                        '</div>'+
                        '<div style = "height:0.08rem; width : 2.6rem;"></div>'+
                        '<div style = "font-size: 0.3rem; text-align:center;">'+
                            val.guest_chance+
                        '</div></div></div></div></div>'
        );
    }

    //绑定事件
    function bindEvent() {
        $('.main-left').click(function(e){
            var ele = e.currentTarget
            ele.classList.toggle('item-active')
            //获取哪一项数据ary.hasOwnProperty(key);
            //对胜平负分别赋值3，2，1，组合，6代表全选
            var key = (ele.dataset.id-0);
            if(!all.hasOwnProperty(key)){
                all[key] = [0,0,0];
            }
            var bool = ele.classList.contains('item-active')
            if(bool){
                all[key][0] = 1;
            }else{
                all[key][0] = 0;
            }
            getCount();
        })
        $('.main-center').click(function(e){
            var ele = e.currentTarget
            ele.classList.toggle('item-active')
            //获取哪一项数据ary.hasOwnProperty(key);
            //对胜平负分别赋值3，2，1，组合，6代表全选
            var key = ele.dataset.id;
            if(!all.hasOwnProperty(key)){
                all[key] = [0,0,0];
            }
            var bool = ele.classList.contains('item-active')
            if(bool){
                all[key][1] = 1;
            }else{
                all[key][1] = 0;
            }
            getCount();
        })
        $('.main-right').click(function(e){
            var ele = e.currentTarget
            ele.classList.toggle('item-active')
            //获取哪一项数据ary.hasOwnProperty(key);
            //对胜平负分别赋值3，2，1，组合，6代表全选
            var key = ele.dataset.id;
            if(!all.hasOwnProperty(key)){
                all[key] = [0,0,0];
            }
            var bool = ele.classList.contains('item-active')
            if(bool){
                all[key][2] = 1;
            }else{
                all[key][2] = 0;
            }
            getCount();
        })
    }

    function getCount(){
		var num = 0;//场数
		count[1] = 1;
	    for(var key in all){
	    	var n = 0;//倍率
	    	if(!(all[key][0] == 0&&all[key][1] == 0&&all[key][2] ==0)){
	    		num ++;
	    	}
	    	if(all[key][0] === 1){
	    		n ++;
	    	}
	    	if(all[key][1] === 1){
	    		n ++;
	    	}
	    	if(all[key][2] === 1){
	    		n ++;
	    	}
	    	count[1] = count[1] * n;
	    }
	    count[0] = num;
	    $("#aaa").text(count[0])
		if(count[0] == 14){
			$("#bbb").text(count[1]*2)
			$(".input-buttun").removeAttr("disabled");
			$(".input-buttun").attr("value", "立即支付");
			$(".input-buttun").css("opacity", 1);
		}else{
			$("#bbb").text(0)
			$(".input-buttun").attr("disabled", true);
			$(".input-buttun").attr("value", "未选满");
			$(".input-buttun").css("opacity", 0.3);
		}
	}

    function pay(params) {
        return new Promise(function(resolve, reject) {
            WeixinJSBridge.invoke("getBrandWCPayRequest",params,function(res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    //支付成功
                    resolve(1)
                }else{
                    //支付失败
                    resolve(0)
                }
            });
        });
    }

	$(document).ready(function(){
        axios.get("/shop/v1/pub/activity/now")
        .then(function(res) {
            return res.data.activity;
        })
        .then(function(activity) {
            var time     = moment(new Date(activity.endtime*1000)).format("YYYY-MM-DD hh:mm")
            $("#top-count").append("<span >足球14场&nbsp&nbsp&nbsp第"+activity.code+ "期</span>");
            $("#top-date").append("<span>截止时间：" +time+"</span>");
            num = activity.code;
            return activity.data
        })
        .then(function(data){
            for(var i in data){
                var $item = render(i,data[i]);
                $('#main').append($item);
            }
            bindEvent();
        })
        .then(function(e) {
            console.log(e);
        });
    });

    //提交按钮点击事件
	$('.input-buttun').click(function(e){
        var multi     = $("#multi").val()-0;
        var ticketid  = "";
        axios.post("/ticket/v1/pub/ticket/make",JSON.stringify({
            code    : num,
            uid     : Cookies.get("uid"),
            data    : all,
            price   : count[1]*2*multi,
            betting : count[1],
            multi   : multi,
            site    : count[0],
        }))
        .then(function(res) {
            ticketid = res.data.ticketid;
            return axios.get("/order/v1/pub/order/make",{
                params : {
                    ticketid : res.data.ticketid,
                },
            })
        })
        .then(function(res) {
            return axios.get("/wxs/v1/pub/wechat/pay",{
                params : {
                    orderid : res.data.orderid,
                },
            })
        })
        .then(function(res) {
            return pay(res.data.params);
        })
        .then(function() {
            window.location.href = "/web/detail.html?"+ticketid
        })
        .catch(function(e) {
            console.log(e);
        });

        //场数和注数
        console.log(count)
		//选择信息
		//all
		//期数
		//num
		console.log(all)

	})

</script>

</html>